<?php
//汽车
class CarBuilder implements BuilderInterface{
    protected $car;
    public function createGongju(){
        $this->car = new Bike();
    }
    //创建轮子
    public function createWheel(){
        $this->car->setParts('wheel1', new Wheel());
        $this->car->setParts('wheel2', new Wheel());
        $this->car->setParts('wheel3', new Wheel());
        $this->car->setParts('wheel4', new Wheel());
    }
    //创建门
    public function createDoor(){
        $this->car->setParts('doorleft', new Door());
        $this->car->setParts('doorright', new Door());
    }
    //创建发动机引擎
    public function createEngine(){
        $this->car->setParts('engine', new Engine());
    }

    //获取创建好的工具
    public function getGongju(){
        return $this->car;
    }
}